using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vPMap : EntityTypeConfiguration<vP>
    {
        public vPMap()
        {
            // Primary Key
            this.HasKey(t => new { t.PSID, t.NUMBER, t.DATE, t.POSTED, t.ARREFERENCE, t.SALETYPE, t.DOCTYPE, t.LOCATION, t.CustCurr, t.ITEM, t.SALESMAN, t.SalesmanID, t.Store, t.CurrSymb, t.CompName, t.CSTCTR });

            // Properties
            this.Property(t => t.NUMBER)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.TIME)
                .HasMaxLength(5);

            this.Property(t => t.REFERENCE)
                .HasMaxLength(20);

            this.Property(t => t.ARREFERENCE)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.SALETYPE)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.DOCTYPE)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.CASHACCT)
                .HasMaxLength(40);

            this.Property(t => t.LOCATION)
                .IsRequired()
                .HasMaxLength(3);

            this.Property(t => t.ARBATCH)
                .HasMaxLength(8);

            this.Property(t => t.GLBATCH)
                .HasMaxLength(8);

            this.Property(t => t.DOCNUM)
                .HasMaxLength(15);

            this.Property(t => t.CUSTADDR)
                .HasMaxLength(50);

            this.Property(t => t.CustID)
                .HasMaxLength(6);

            this.Property(t => t.CUSTPHONE)
                .HasMaxLength(20);

            this.Property(t => t.LPO)
                .HasMaxLength(30);

            this.Property(t => t.CustCurr)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.CUSTNAME)
                .HasMaxLength(35);

            this.Property(t => t.ORDERNUM)
                .HasMaxLength(8);

            this.Property(t => t.QUOTENUM)
                .HasMaxLength(8);

            this.Property(t => t.DELNOTENUM)
                .HasMaxLength(8);

            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.SALESMAN)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.SalesmanID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Register)
                .HasMaxLength(30);

            this.Property(t => t.DefaultRegLocation)
                .HasMaxLength(20);

            this.Property(t => t.Store)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.CurrName)
                .HasMaxLength(20);

            this.Property(t => t.CurrSymb)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.CreateUser)
                .HasMaxLength(30);

            this.Property(t => t.EditUser)
                .HasMaxLength(30);

            this.Property(t => t.VoidUser)
                .HasMaxLength(30);

            this.Property(t => t.ItmDescription)
                .HasMaxLength(250);

            this.Property(t => t.BinLocation)
                .HasMaxLength(30);

            this.Property(t => t.CompName)
                .IsRequired()
                .HasMaxLength(55);

            this.Property(t => t.CompAddr1)
                .HasMaxLength(33);

            this.Property(t => t.CompAddr2)
                .HasMaxLength(33);

            this.Property(t => t.CompCity)
                .HasMaxLength(24);

            this.Property(t => t.CompPhone)
                .HasMaxLength(12);

            this.Property(t => t.CompFAX)
                .HasMaxLength(12);

            this.Property(t => t.VAT_REG_NUM)
                .HasMaxLength(30);

            this.Property(t => t.CustAcct)
                .HasMaxLength(40);

            this.Property(t => t.INVMESSAGE)
                .HasMaxLength(254);

            this.Property(t => t.CSTCTR)
                .IsRequired()
                .HasMaxLength(9);

            this.Property(t => t.UnitofSales)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("vPS");
            this.Property(t => t.PSID).HasColumnName("PSID");
            this.Property(t => t.NUMBER).HasColumnName("NUMBER");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.TIME).HasColumnName("TIME");
            this.Property(t => t.SUBTOTAL).HasColumnName("SUBTOTAL");
            this.Property(t => t.POSTED).HasColumnName("POSTED");
            this.Property(t => t.VOID).HasColumnName("VOID");
            this.Property(t => t.HOLD).HasColumnName("HOLD");
            this.Property(t => t.REFERENCE).HasColumnName("REFERENCE");
            this.Property(t => t.ARREFERENCE).HasColumnName("ARREFERENCE");
            this.Property(t => t.SALETYPE).HasColumnName("SALETYPE");
            this.Property(t => t.DOCTYPE).HasColumnName("DOCTYPE");
            this.Property(t => t.CASHACCT).HasColumnName("CASHACCT");
            this.Property(t => t.ONACCOUNT).HasColumnName("ONACCOUNT");
            this.Property(t => t.LOCATION).HasColumnName("LOCATION");
            this.Property(t => t.DUEDATE).HasColumnName("DUEDATE");
            this.Property(t => t.CLOSEDOUT).HasColumnName("CLOSEDOUT");
            this.Property(t => t.ARBATCH).HasColumnName("ARBATCH");
            this.Property(t => t.GLBATCH).HasColumnName("GLBATCH");
            this.Property(t => t.EXPDELIVDATE).HasColumnName("EXPDELIVDATE");
            this.Property(t => t.DELIVDATE).HasColumnName("DELIVDATE");
            this.Property(t => t.TRADETYPE).HasColumnName("TRADETYPE");
            this.Property(t => t.DISCVAL).HasColumnName("DISCVAL");
            this.Property(t => t.TOTAL).HasColumnName("TOTAL");
            this.Property(t => t.CHANGEDUE).HasColumnName("CHANGEDUE");
            this.Property(t => t.DOCNUM).HasColumnName("DOCNUM");
            this.Property(t => t.CUSTADDR).HasColumnName("CUSTADDR");
            this.Property(t => t.TAX).HasColumnName("TAX");
            this.Property(t => t.CustID).HasColumnName("CustID");
            this.Property(t => t.CUSTPHONE).HasColumnName("CUSTPHONE");
            this.Property(t => t.LPO).HasColumnName("LPO");
            this.Property(t => t.PS_VAT_RATE).HasColumnName("PS_VAT_RATE");
            this.Property(t => t.CustCurr).HasColumnName("CustCurr");
            this.Property(t => t.CUSTNAME).HasColumnName("CUSTNAME");
            this.Property(t => t.Duration).HasColumnName("Duration");
            this.Property(t => t.Production).HasColumnName("Production");
            this.Property(t => t.ORDERNUM).HasColumnName("ORDERNUM");
            this.Property(t => t.QUOTENUM).HasColumnName("QUOTENUM");
            this.Property(t => t.DELNOTENUM).HasColumnName("DELNOTENUM");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.QTYSHIP).HasColumnName("QTYSHIP");
            this.Property(t => t.EXTEND).HasColumnName("EXTEND");
            this.Property(t => t.EXTENDADISC).HasColumnName("EXTENDADISC");
            this.Property(t => t.EXPIRYDATE).HasColumnName("EXPIRYDATE");
            this.Property(t => t.LINETAX).HasColumnName("LINETAX");
            this.Property(t => t.DEBIT).HasColumnName("DEBIT");
            this.Property(t => t.COST).HasColumnName("COST");
            this.Property(t => t.UnitPrice).HasColumnName("UnitPrice");
            this.Property(t => t.ItmDiscount).HasColumnName("ItmDiscount");
            this.Property(t => t.ItmDiscPerc).HasColumnName("ItmDiscPerc");
            this.Property(t => t.SALESMAN).HasColumnName("SALESMAN");
            this.Property(t => t.SalesmanID).HasColumnName("SalesmanID");
            this.Property(t => t.Register).HasColumnName("Register");
            this.Property(t => t.DefaultRegLocation).HasColumnName("DefaultRegLocation");
            this.Property(t => t.Store).HasColumnName("Store");
            this.Property(t => t.CurrName).HasColumnName("CurrName");
            this.Property(t => t.CurrSymb).HasColumnName("CurrSymb");
            this.Property(t => t.CreateUser).HasColumnName("CreateUser");
            this.Property(t => t.EditUser).HasColumnName("EditUser");
            this.Property(t => t.VoidUser).HasColumnName("VoidUser");
            this.Property(t => t.ItmDescription).HasColumnName("ItmDescription");
            this.Property(t => t.VAT_ENABLED).HasColumnName("VAT_ENABLED");
            this.Property(t => t.BinLocation).HasColumnName("BinLocation");
            this.Property(t => t.CompName).HasColumnName("CompName");
            this.Property(t => t.CompAddr1).HasColumnName("CompAddr1");
            this.Property(t => t.CompAddr2).HasColumnName("CompAddr2");
            this.Property(t => t.CompCity).HasColumnName("CompCity");
            this.Property(t => t.CompPhone).HasColumnName("CompPhone");
            this.Property(t => t.CompFAX).HasColumnName("CompFAX");
            this.Property(t => t.VAT_REG_NUM).HasColumnName("VAT_REG_NUM");
            this.Property(t => t.ENABLE_VAT).HasColumnName("ENABLE_VAT");
            this.Property(t => t.ENABLE_IN_VAT).HasColumnName("ENABLE_IN_VAT");
            this.Property(t => t.ENABLE_OUT_VAT).HasColumnName("ENABLE_OUT_VAT");
            this.Property(t => t.VAT_RATE).HasColumnName("VAT_RATE");
            this.Property(t => t.CustAcct).HasColumnName("CustAcct");
            this.Property(t => t.INVMESSAGE).HasColumnName("INVMESSAGE");
            this.Property(t => t.CSTCTR).HasColumnName("CSTCTR");
            this.Property(t => t.UnitofSales).HasColumnName("UnitofSales");
        }
    }
}
